
n=29;

delta_r = 8.8;
min_r = 49;
center = [300, 300];

r = min_r + (0:(n-1)) * delta_r;
theta = -pi/2-0.1+((1:29)-0)/29 * 2 * pi;
x = repmat(r, 29, 1) .* repmat(sin(theta'), 1, 29);
y = repmat(r, 29, 1) .* repmat(cos(theta'), 1, 29);

x = x(:) + center(1);
y = y(:) + center(2);


figure(1);clf;
imshow(img); hold on;
plot(x, y, '.');
plot(x(30), y(30), '*');
axis equal;

figure(2);clf;
bin = rgb2gray(img) > 128;
imshow(bin);

figure(3); clf;
inds = sub2ind([600, 600], round(y), round(x));
code = bin(inds);
code = reshape(code, 29, 29);
imshow(code);

figure(4); clf;
imshow(imrotate(code, -90));
